package com.twotiger.and.activity.others;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import app.twotiger.p2p.R;

import com.twotiger.and.activity.base.BaseActivity;
import com.twotiger.and.bean.SystemMessage;
import com.twotiger.and.util.DateUtil;

public class SystemMessageDetailPage extends BaseActivity {

    private TextView sub_title_center_tv;
    private ImageView sub_title_left_bt;
    private TextView tv_title;
    private TextView message_content;
    private TextView send_time;

    @Override
    protected void processLogic() {
        sub_title_center_tv.setText("消息详情");
        sub_title_left_bt.setVisibility(View.VISIBLE);
        SystemMessage message = (SystemMessage) getIntent().getSerializableExtra("MESSAGE");
        tv_title.setText(message.getTitle());
        message_content.setText(message.getContent());
        send_time.setText(""
                          + DateUtil.getDateStringForLong(Long.valueOf(message.getSendedtime()),DateUtil.FMT));
    }

    @Override
    protected void setListener() {
        sub_title_left_bt.setOnClickListener(this);
    }

    @Override
    protected void findViewById(View view) {
        sub_title_center_tv = (TextView) view.findViewById(R.id.sub_title_center_tv);
        sub_title_left_bt = (ImageView) view.findViewById(R.id.sub_title_left_bt);
        tv_title = (TextView) view.findViewById(R.id.tv_title);
        message_content = (TextView) view.findViewById(R.id.message_content);
        send_time = (TextView) view.findViewById(R.id.send_time);
    }

    @Override
    protected void onBackPress() {
        finish();
        overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
    }

    @Override
    protected View loadViewLayout(LayoutInflater inflater) {
        View view = inflater.inflate(R.layout.message_detail, null);
        return view;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
        case R.id.sub_title_left_bt:
            onBackPress();
            break;
        default:
            break;
        }
    }

}
